package com.xunker.msm.utils;


import com.xunker.appointment.vo.mq.EmailVo;
import com.xunker.msm.service.MsmService;
import com.xunker.rabbit.constant.MqConst;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;


/**
 * MQ监听
 */
@Component
public class MqListener {
    @Autowired
    private MsmService msmService;
    @RabbitListener(bindings = @QueueBinding(
            value = @Queue(value = MqConst.QUEUE_EMAIL_ITEM, durable = "true"),
            exchange = @Exchange(value = MqConst.EXCHANGE_DIRECT_EMAIL),
            key = {MqConst.ROUTING_EMAIL_ITEM}
    ))
    public void send(EmailVo emailVo) {
        msmService.sendMqEmail(emailVo);
    }
}
